<!--纵向布局-->
<script lang="ts" setup>
import ToolBarLeft from '@/layouts/components/Hheader/ToolBarLeft.vue'
import ToolBarRight from '@/layouts/components/Hheader/ToolBarRight.vue'
import SubMenu from '@/layouts/components/Menu/SubMenu.vue'
import Main from '@/layouts/components/Main/index.vue'
import {computed} from 'vue'
import useThemeStore from '@/store/theme.ts'
import useRouteStore from '@/store/route.ts'
import {useRoute} from 'vue-router'

const route = useRoute()
const themeStore = useThemeStore()
const routeStore = useRouteStore()
const baseTitle = import.meta.env.VITE_APP_TITLE
const isCollapse = computed(() => themeStore.isCollapse)
const menuList = computed(() => routeStore.getShowMenuList)
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path))
</script>

<template>
	<el-container class="layout">
		<el-aside>
			<div :style="{ width: isCollapse ? '65px' : '210px' }" class="menu">
				<div class="logo flx-center">
					<img alt="logo" src="@/assets/images/logo.svg">
					<span v-show="!isCollapse">{{ baseTitle }}</span>
				</div>
				<el-scrollbar>
					<el-menu
						:collapse="isCollapse"
						:collapse-transition="false"
						:default-active="activeMenu"
						:router="false"
						:unique-opened="true"
						active-text-color="#ffffff"
						background-color="#191a20"
						text-color="#bdbdc0"
					>
						<SubMenu :menu-list="menuList"/>
					</el-menu>
				</el-scrollbar>
			</div>
		</el-aside>
		<el-container>
			<el-header>
				<ToolBarLeft/>
				<ToolBarRight/>
			</el-header>
			<Main/>
		</el-container>
	</el-container>
</template>

<style lang="scss" scoped>
@import "./index.scss";
</style>

<style lang="scss">
.vertical {
	.el-menu,
	.el-menu--popup {
		.el-menu-item {
			&.is-active {
				background: #060708;

				&::before {
					position: absolute;
					top: 0;
					bottom: 0;
					left: 0;
					width: 4px;
					content: "";
					background: var(--el-color-primary);
				}
			}
		}
	}
}
</style>
